package com.css.bjdt_report.report.service;

import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ReportTemplateCommentService {

	@Autowired
	private Dao dao;

	//报表批注验证，根据报表实例ID，和报表模板中的行列数，得到该单元格是否填写过批注
	public String getReportCellCommentCount(String templateDateId, Integer absColNum, Integer absRowNum,
			String annualId) {
		String tableName = "RPT_CELL_COMM_" + annualId;
		Sql strSql = Sqls.create("select count(*) from " + tableName + " where TEMPLATE_DATA_ID = @templateId"
				+ " and ABS_ROW_NUM = @absRowNum and ABS_COL_NUM = @absColNum");
		strSql.params().set("templateId", templateDateId).set("absRowNum", absRowNum).set("absColNum", absColNum);
		strSql.setCallback(Sqls.callback.integer());
		dao.execute(strSql);
		return strSql.getObject(Integer.class) + "";
	}

}
